load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "infoschema",
    srcs = [
        "builder.go",
        "cache.go",
        "cluster.go",
        "error.go",
        "infoschema.go",
        "metric_table_def.go",
        "metrics_schema.go",
        "tables.go",
    ],
    importpath = "github.com/pingcap/tidb/infoschema",
    visibility = ["//visibility:public"],
    deps = [
        "//config",
        "//ddl/placement",
        "//ddl/resourcegroup",
        "//domain/infosync",
        "//errno",
        "//infoschema/metrics",
        "//kv",
        "//meta",
        "//meta/autoid",
        "//parser/auth",
        "//parser/charset",
        "//parser/model",
        "//parser/mysql",
        "//parser/terror",
        "//privilege",
        "//session/txninfo",
        "//sessionctx",
        "//sessionctx/variable",
        "//table",
        "//table/tables",
        "//types",
        "//util",
        "//util/dbterror",
        "//util/deadlockhistory",
        "//util/domainutil",
        "//util/execdetails",
        "//util/logutil",
        "//util/mathutil",
        "//util/mock",
        "//util/pdapi",
        "//util/sem",
        "//util/set",
        "//util/sqlexec",
        "//util/stmtsummary",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/diagnosticspb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//credentials",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "infoschema_test",
    timeout = "short",
    srcs = [
        "infoschema_test.go",
        "main_test.go",
        "metrics_schema_test.go",
    ],
    embed = [":infoschema"],
    flaky = True,
    shard_count = 11,
    deps = [
        "//ddl/placement",
        "//domain",
        "//kv",
        "//meta",
        "//meta/autoid",
        "//parser/model",
        "//parser/mysql",
        "//session",
        "//store/mockstore",
        "//table",
        "//testkit",
        "//testkit/testsetup",
        "//testkit/testutil",
        "//types",
        "//util",
        "//util/set",
        "@com_github_pingcap_errors//:errors",
        "@com_github_prometheus_prometheus//promql",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
